<div class="bodywrap"> 
<?php $userdetails=Users::model()->getModel("USER-ID",array('userid'=>Yii::app()->user->id));?>
 <!-- <div data-role="page" id="<?php //echo $key+1;?>" data-theme="e" class="searchPage" data-url="page=<?php //echo $key+1;?>">--> 
    <div data-role="content" style="margin:0;padding:0">
        
            <ul data-role="listview" data-inset="true" data-theme="e" style="margin:0;padding:0">
                <li id="listitem" style="margin:0;padding:0; border:0">
                   <div class="subhead">Settings</div>
	<div style="width:99%; margin:0 auto"></div>
	
<div style="padding:10px 0; margin:5px 0 0 0; background:#e5e8ef;">
    <div class="quizbutton">
		<div class="grades"></div>
		<div id="statusmsgs" style='color:green;'></div>
		<?php if(Yii::app()->user->hasFlash('successpassword')){
       echo "<div style='color:green;'>".Yii::app()->user->getFlash('successpassword')."</div>";
    }?>
    <?php 
    $userdetails=Users::model()->getModel("USER-ID",array('userid'=>Yii::app()->user->id));
    ?>
		<div><a  data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'scoreCard');?>" data-role="button" class="ui-btn-right" data-theme="e" >Score Board</a></div>
		<div><a  data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'changepassword');?>"  data-role="button" class="ui-btn-right" data-theme="e" >Change Password</a></div>
		<div><a  data-icon="arrow-r" id="moviemode" onclick="setmoviemode()"  data-role="button" class="ui-btn-right" data-theme="e" >Movie Mode - <?php echo $userdetails->movie_mode;?></a></div>
		<div><a  data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'setgrade',array('orgid'=>$userdetails->org_id));?>"  data-role="button" class="ui-btn-right" data-theme="e" >Change Grade</a></div>
    	<div><a  data-icon="arrow-r" rel="external" href="<?php echo ApplicationConfig::getURL('', 'site', 'logout');?>"  data-role="button" class="ui-btn-right" data-theme="e" >Logout</a></div>
        <br clear="all"/> 
        <div>
        	<?php $this->widget('application.widgets.termsofuse');?>
        </div>
    	
	</div>  
	 
</div>
            
            
                </li>
            </ul>
       
    </div>
</div>

<script type="text/javascript">
function setmoviemode()
{ 
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
	    document.getElementById("moviemode").innerHTML=xmlhttp.responseText;
	   	document.getElementById("statusmsgs").innerHTML='Movie mode status updated successfully';
	    }
	  }
	xmlhttp.open("GET","<?php echo ApplicationConfig::getURL('', 'site', 'setMovieMode');?>",true);
	xmlhttp.send();
}
</script> 

</div>
